<?php
class Asset_model extends MY_Model
{
	public $table = 'ASSETS';
	
	public function __construct()
	{
		parent::__construct();
		if(!$this->is_table_exit()) $this->create();
	}
	
	public function create()
	{
		$sql = 'CREATE TABLE DB2INST1.ASSETS
		(
			ID INTEGER,
			FUND_ID INT,
			AGENCY_ID INT,
			DATE_RECORD DATE,
			TITLE VARCHAR(300),
			UNIT INT,
			COST DECIMAL(20,2),
			PRICE DECIMAL(20,2),
			LIFETIME INT,
			PRICES_COLLAPSED DECIMAL(20,2),
			DEPRECIATION DECIMAL(20,2),
			NET DECIMAL(20,2),
			PS LONG VARCHAR,
			ASSET_CLASS_ID INT,
			CODE VARCHAR(100),
			PROPERTY VARCHAR(300),
			MODEL VARCHAR(250),
			AGENCIES_RESPONSIBLE LONG VARCHAR,
			VENDORS VARCHAR(250),
			ADDRESS_RESPONSIBLE LONG VARCHAR,
			TELEPHONE VARCHAR(100),
			FAX VARCHAR(100),
			MONEY_TYPE_1 INT,
			MONEY_TYPE_2 INT,
			MONEY_TYPE_3 INT,
			MONEY_TYPE_4 INT,
			ACQUIRE_1 INT,
			ACQUIRE_2 INT,
			ACQUIRE_3 INT,
			ACQUIRE_4 INT,
			ACQUIRE_5 INT
		)';
		return $this->db->execute($sql);
	}
}
?>